// Learn cc.Class:
//  - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

@ccclass
export default class DropItem extends cc.Component {

    @property(cc.Label)
    text: cc.Label = null;

    isPlainObject(val){
        return  val !== null && !Array.isArray(val) && typeof val === 'object';
    }

    setItem (data) {
        if (typeof(data) == "object") {
            this.text.string = data.text + '';
        } else {
            this.text.string = data + '';
        }
        
    }
}
